<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />

<script type="text/javascript">

    function chooseUploadType(trId,type){
        if(type=="upload"){
            if(!confirm("切换到方法一模式会清空您输入的文本，是否需要切换")){
                $("#note1 input[name='check']:checked").attr("checked",false);
                $($("#note1 input[name='check']").get(1)).attr("checked",true);
                return;
            }
            $("#prpContent_text").find("textarea").text("");

        }
        $("table[id^='"+trId+"']").each(function(){
            if($(this).attr("id")==trId+"_"+type){
                $(this).show();

            }
            else{
                $(this).hide();
            }
        });
    }

    $(function($) {
        var fileObj = $("#prpContent_upload").find("span[name$='file_name']");
        var fileName = $("#fileNameHid").val();// 获得文件名
        var start = fileName.substring(0, fileName.indexOf("."));// 获得前缀
        var end =fileName.substring(fileName.indexOf(".") + 1,fileName.length);// 获得后缀
        var image = "";
        $("#contentImage").remove();
        if (end.toLowerCase() == "doc" || end.toLowerCase() == "docx") {
            image = "<img id=\"contentImage\" src=\"" + res
                + "/images/ico_word.gif\">";
        } else if (end.toLowerCase() == "pdf") {
            image = "<img id=\"contentImage\" src=\"" + res
                + "/images/ico_pdf.gif\">";
        } else if (end.toLowerCase() == "wps") {
            image = "<img id=\"contentImage\" src=\"" + res
                + "/images/ico_wps.gif\">";
        }
        fileObj.before(image);
        fileObj.html(fileName);
    });
    /**
     * 下载可行性报告 将抽取至public.js 中
     */
    function ContentDownDesc(template)
    {
        frameDownLoad.document.location=res_hn+"/template/content/content/"+encodeURIComponent(template);
        return false;
    }
</script>
<table class="table01 t_css" width="100%" border="0" cellpadding="0"  cellspacing="1">
    <c:set var="title">${param.title}</c:set>
    <c:set var="grantCode"><x:out select="$xmlData/data/proposal/grant_code" /></c:set>
    <c:set var="subGrantCode"><x:out select="$xmlData/data/proposal/sub_grant_code" /></c:set>

    <c:set var="file_code"><x:out select="$xmlData/data/content/file_code" /></c:set>
    <tr id="uploadsuccessqhh" <c:if test="${file_code==''}" >style="display:none" </c:if> >
        <td>
            <input type="hidden" id="fileNameHid" value="<x:out select="$xmlData/data/content/file_name" />"/>
            已经上传的${title}：<a id="content_downLoadFileqhh" href="${ctx}/file/ajax-filedownload?fileCode=${file_code}" class="link_x" ><span><x:out select="$xmlData/data/content/file_name" /></span></a>&nbsp;&nbsp;(上传时间<span><x:out select="$xmlData/data/content/file_date" /></span>)
        </td>
    </tr>
    <tr id="uploadsuccessqhh" <c:if test="${file_code!=''}" >style="display:none" </c:if> >
        <td>
            未上传${title}
        </td>
    </tr>
</table>

